import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 食堂信息信息 */
export interface CanteenInfo {
          id: number; // ID
          canteenSn: string;
          name?: string; // 名称
          manager: string; // 管理人
          mail: string; // MAIL 
          phone: string; // 电话
          address: string; // 地址
          imgUrl: string; // 图片
          intro: string; // 描述
  }

// 食堂信息 API
export const CanteenInfoApi = {

  // 查询食堂列表
  getCanteenSimpleList: async () => {
    return await request.get({ url: `/rbt/canteen-info/simple-list` })
  },
 
  // 查询食堂信息分页
  getCanteenInfoPage: async (params: any) => {
    return await request.get({ url: `/rbt/canteen-info/page`, params })
  },

  // 查询食堂信息详情
  getCanteenInfo: async (id: number) => {
    return await request.get({ url: `/rbt/canteen-info/get?id=` + id })
  },

  // 新增食堂信息
  createCanteenInfo: async (data: CanteenInfo) => {
    return await request.post({ url: `/rbt/canteen-info/create`, data })
  },

  // 修改食堂信息
  updateCanteenInfo: async (data: CanteenInfo) => {
    return await request.put({ url: `/rbt/canteen-info/update`, data })
  },

  // 删除食堂信息
  deleteCanteenInfo: async (id: number) => {
    return await request.delete({ url: `/rbt/canteen-info/delete?id=` + id })
  },

  /** 批量删除食堂信息 */
  deleteCanteenInfoList: async (ids: number[]) => {
    return await request.delete({ url: `/rbt/canteen-info/delete-list?ids=${ids.join(',')}` })
  },

  // 导出食堂信息 Excel
  exportCanteenInfo: async (params) => {
    return await request.download({ url: `/rbt/canteen-info/export-excel`, params })
  }
}
